import 'dart:convert';
import 'dart:io';

import 'package:dio/dio.dart';

class JsonInterceptor extends InterceptorsWrapper {
  @override
  Future onRequest(RequestOptions option) async {
    if (option.data is FormData) {
      option.contentType="multipart/form-data";
    }else{
      option.data = json.encode(option.data);
      option.responseType = ResponseType.json;
    }
    return option;
  }
}
